import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Label;
import org.eclipse.wb.swt.SWTResourceManager;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.widgets.Canvas;


public class ViewAppointments {

	protected Shell shell;
	private Table table;
	private Table table_1;
	private Table table_2;

	/**
	 * Launch the application.
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			ViewAppointments window = new ViewAppointments();
			window.open();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Open the window.
	 */
	public void open() {
		Display display = Display.getDefault();
		createContents();
		shell.open();
		shell.layout();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
	}

	/**
	 * Create contents of the window.
	 */
	protected void createContents() {
		shell = new Shell();
		shell.setSize(700, 500);
		shell.setText("SWT Application");
		shell.setLayout(null);
		
		TabFolder tabFolder = new TabFolder(shell, SWT.NONE);
		tabFolder.setBounds(12, 94, 676, 314);
		
		Label lblViewAppointments = new Label(shell, SWT.NONE);
		lblViewAppointments.setBounds(175, 20, 256, 30);
		lblViewAppointments.setFont(SWTResourceManager.getFont("Lucida Grande", 25, SWT.BOLD));
		lblViewAppointments.setText("View Appointments");
		
		Button btnBack = new Button(shell, SWT.NONE);
		btnBack.setBounds(155, 420, 73, 30);
		btnBack.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseUp(MouseEvent e) {
				Object window;
				shell.close();
				window = new NurseDoctor();
				((NurseDoctor)window).open();
				
			}
		});
		btnBack.setText("Back");
		
		Button btnAdd = new Button(shell, SWT.NONE);
		btnAdd.setBounds(246, 420, 71, 30);
		btnAdd.setText("Add");
		
		Button btnSubmit = new Button(shell, SWT.NONE);
		btnSubmit.setBounds(335, 420, 70, 30);
		btnSubmit.setText("Submit");
		
		//adding background
		final Display display = Display.getDefault();
		Canvas canvas = new Canvas(shell, SWT.NONE);
		canvas.addPaintListener(new PaintListener() {
			public void paintControl(PaintEvent arg0) {
					 org.eclipse.swt.graphics.Image image = new org.eclipse.swt.graphics.Image(display, "/Users/kennyha/Desktop/Eclipse Workplace/pokemonBackground.png");
					 arg0.gc.drawImage(image, 10, 10);

				        image.dispose();
				
			}
		});
		canvas.setBounds(-14, -22, 714, 500);
		
		
		TabItem tbtmDrA = new TabItem(tabFolder, SWT.NONE);
		tbtmDrA.setText("Dr A");
		
		Composite composite = new Composite(tabFolder, SWT.NONE);
		tbtmDrA.setControl(composite);
		
		table = new Table(composite, SWT.BORDER | SWT.FULL_SELECTION);
		table.setBounds(10, 0, 540, 276);
		table.setHeaderVisible(true);
		table.setLinesVisible(true);
		
		TabItem tbtmDrB = new TabItem(tabFolder, SWT.NONE);
		tbtmDrB.setText("Dr B");
		
		Composite composite_1 = new Composite(tabFolder, SWT.NONE);
		tbtmDrB.setControl(composite_1);
		
		table_1 = new Table(composite_1, SWT.BORDER | SWT.FULL_SELECTION);
		table_1.setBounds(10, 10, 540, 94);
		table_1.setHeaderVisible(true);
		table_1.setLinesVisible(true);
		
		TabItem tbtmDrC = new TabItem(tabFolder, SWT.NONE);
		tbtmDrC.setText("Dr C");
		
		Composite composite_2 = new Composite(tabFolder, SWT.NONE);
		tbtmDrC.setControl(composite_2);
		
		table_2 = new Table(composite_2, SWT.BORDER | SWT.FULL_SELECTION);
		table_2.setBounds(10, 0, 345, 198);
		table_2.setHeaderVisible(true);
		table_2.setLinesVisible(true);

	}
}
